<?php
/**
 * Pertyler
 * Connector Row Redirected To Object Browser Page
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pertyler;

require 'main.php';

if((empty($page->ParentTable)) OR (empty($page->Row)))
	die;

if(!Pertyler_Table::Select($page->ParentTable)->ConnectorTable())
	die;

$parentTable = Pertyler_Table::Select($page->ParentTable);

$row = $parentTable->SelectRow($page->Row);

$columnArray = $row->SelectColumnArray();

$parentTable = $columnArray[1]->RelatedTable();

$row = $columnArray[1]->Value();

if(!$row)
	throw new Exception('Row cannot found');

unset($columnArray);

$page->ParentTable = $parentTable->id();

$page->Row = $row->id();

require 'ObjectBrowser.php';